import AI
from Chessnut import Game

i = 0
o = 0
t = 0
playnow = 0
lastscr = 0
while i < 10:
    chessgame = Game()
    while True:
        if playnow == 1:
            moves = chessgame.get_moves()
            if len(moves) == 0:
                print("You win.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
                t += 1
                break
            else:
                #print("AI thinking...")
                move = AI.GiveBestMove(chessgame, 'w', 2, lastscr)
                chessgame.apply_move(move[0])
                print("move to: " + move[0])
                lasrscr = move[1]
                #print(printboard(AI.boardlist(AI.StrGame(chessgame))))
                playnow = 0
        elif playnow == 0:
            moves = chessgame.get_moves()
            if len(moves) == 0:
                print("You lost.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
                o += 1
                break
            else:
                move = AI.GiveBestMove(chessgame, 'b', 1, lastscr)
                chessgame.apply_move(move[0])
                print("move to: " + move[0])
                lasrscr = move[1]
                playnow = 1
    i += 1
    
print(t, o)